import java.util.*;

/**
 * Created with Gitee
 * author:ju bai
 * Date:2021/5/9
 * Time:20:38
 **/
public class Main1 {
    /**
     * 每日一题-汽水瓶
     *
     * @param args
     */
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            if (n > 0) {
                //相当于每两个汽水瓶换一个
                System.out.println(n / 2);
            }
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            if(n>0) {
                System.out.println(getNum(n));
            }
        }
    }

    /**
     * 兑换汽水瓶
     * @param num 有几个
     * @return 换几个
     */
    public static int getNum(int num) {
        int sum = 0;//累加汽水的个数
        while (num>1) {
            sum += num / 3;//兑换的汽水个数
            num = num / 3 + num & 3;//剩余的空瓶子个数
            if (num == 2){
                //借一瓶
                sum++;
                break;
            }
        }
        return sum;
    }
}